#include "../head.h"

int main()
{
    double a = 1, b = 0, res;
    // try是需要执行的语句块，throw后语句块结束执行，跳转到参数和throw数据类型匹配的catch块，然后执行try...catch模块之后的代码
    try
    {
        cout << "before dividing" << endl;
        if(b == 0)
            throw -1;
        res = a/b;
        cout << "after dividing" << endl;
    }
    catch(double c)
    {
        cout << "double catched " << c << endl;
    }
    catch(int d)
    {
        cout << "int catched " << d << endl;
    }
    cout << "try...catch finish" <<endl;
}